﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace vf_test
{
    internal class Point3D
    {
        public double x, y, z;
        public Point3D(double x, double y, double z)
        {
            this.x = x;
            this.y = y;
            this.z = z;
        }
        public static Point3D From(string input)
        {
            string[] parts = input.Split(',');
            if (parts.Length != 3)
            {
                throw new ArgumentException("输入必须是三维点，以逗号分割");
            }

            double x, y, z;
            if (!double.TryParse(parts[0], out x) ||
                !double.TryParse(parts[1], out y) ||
                !double.TryParse(parts[2], out z))
            {
                throw new ArgumentException("非法输入");
            }

            return new Point3D(x, y, z);
        }
    }
}
